package com.meituan;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * 美团第一题
 */
public class test1 {

    static int[] ans = {2178, 21978, 219978, 2199978, 21782178, 21999978};


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();

            List<int[]> res = new ArrayList<>();

            for(int i = 0; i<ans.length; i++){
                if(n > ans[i]){
                    res.add(new int[]{ans[i] , ans[i] * 4});
                }
            }

            System.out.println(res.size());
            res.forEach(e -> {
                System.out.println(e[0] + " " + e[1]);
            });
        }

    }

    /**
     * 不超过 n 的数字中有多少个新定义的逆序对
     */
    public static List<int[]> getNiXuDui(int n){
        ArrayList<int[]> res = new ArrayList<>();
        for(int i = 1; i<n; i++){
            if(check(i))
                res.add(new int[]{i,i*4});
        }
        return res;
    }

    public static boolean check(int a){
        int b = Integer.valueOf(new StringBuilder(String.valueOf(a)).reverse().toString());
        return b == a << 2;
    }

    @Test
    public void test(){
        System.out.println(check(1100));
    }


}
